


import pymysql




host="localhost"
username = "root"
pwd = "root"
db = "finance"



def update(sql,param):
    con  = pymysql.connect(host=host,user=username,password=pwd,database=db)
    cursor = con.cursor()
    cursor.execute(sql,param)
    con.commit()
    cursor.close()
    con.close()


def select(sql,param):
    con = pymysql.connect(host=host,user=username,password=pwd,database=db)
    cursor = con.cursor()
    cursor.execute(sql,param)
    data = cursor.fetchall()

    con.commit()
    cursor.close()
    con.close()
    return data










